<template>
  <el-form
    ref="ruleFormRef2"
    :model="ruleForm2"
    :rules="rules2"
    label-width="120px"
    class="demo-ruleForm"
    :size="formSize"
    status-icon
  >
    <el-form-item label="Activity name2" prop="name2">
      <el-input v-model="ruleForm2.name2" />
    </el-form-item>
    <el-form-item label="Activity name2" prop="name2">
      <el-input v-model="ruleForm2.name2" />
    </el-form-item>
    <el-form-item label="Activity name2" prop="name2">
      <el-input v-model="ruleForm2.name2" />
    </el-form-item>
    <el-form-item label="Activity name2" prop="name2">
      <el-input v-model="ruleForm2.name2" />
    </el-form-item>
    <el-form-item label="Activity zone2" prop="region2">
      <el-select v-model="ruleForm2.region2" placeholder="Activity zone">
        <el-option label="Zone one" value="shanghai" />
        <el-option label="Zone two" value="beijing" />
      </el-select>
    </el-form-item>

  </el-form>
</template>

<script lang="ts" setup>
import { reactive, ref ,defineProps,computed,defineEmits} from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
const formSize = ref('default')
interface RuleForm {
  name?: string
  region?: string,
  name2?:string,
  region2?:string
}


const ruleFormRef2 = ref<FormInstance>()
const ruleForm2 = reactive<RuleForm>({
  name2: 'Hello',
  region2: '',
})


const rules2 = reactive({
  name2: [
    { required: true, message: 'Please input Activity name', trigger: 'blur' },
    { min: 3, max: 5, message: 'Length should be 3 to 5', trigger: 'blur' },
  ],
  region2: [
    {
      required: true,
      message: 'Please select Activity zone',
      trigger: 'change',
    },
  ],
})
const submitForm = async () => {
  if (!ruleFormRef2.value) return
  let result =false
  await ruleFormRef2.value.validate((valid, fields) => {
    result=valid
  })
  return result
}
defineExpose({
  submitForm,
})
</script>
<style lang="scss" scoped>
</style>